<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
	<script type="text/javascript">
		function aaa(){
			console.log(this)
		}
		aaa()
		function Baa(){
			console.log(this)
		}
		new Baa()
		
		
		
		var amd={
			a:1,
			b:2
		}
		
		var amd2={
			a:1,
			b:2
		}
		
		function diff(obj1,obj2){
            var o1 = obj1 instanceof Object;
            var o2 = obj2 instanceof Object;
            if(!o1 || !o2){/*  判断不是对象  */
                return obj1 === obj2;
            }

            if(Object.keys(obj1).length !== Object.keys(obj2).length){
                return false;
                //Object.keys() 返回一个由对象的自身可枚举属性(key值)组成的数组,例如：数组返回下表：let arr = ["a", "b", "c"];console.log(Object.keys(arr))->0,1,2;
            }

            for(var attr in obj1){
				
                var t1 = obj1[attr] instanceof Object;
                var t2 = obj2[attr] instanceof Object;
				console.log(t1 && t2)
                if(t1 && t2){
					console.log(11)
                    return diff(obj1[attr],obj2[attr]);
                }else if(obj1[attr] !== obj2[attr]){
					console.log(22)
                    return false;
                }
            }
            return true;
        }
		console.log(diff(amd,amd2))
		console.log(Object.is(amd,amd2))
	</script>
  <div class="test">你好世界</div>
  <div class="test2">你好世界</div>
</body>
</html>


<style type="text/css">
	.test{
  position: absolute;
  background: black;  
  color: white;
  width: 300px;
  bottom: 0px;
  top: 0px;
  
}

.test2{
  position: absolute;
  background: purple;
  color: white;
  right: 0;
  left: 300px;
  top: 0;
  bottom: 0;
}
</style>